#ifndef PLATFORM_HPP
#define PLATFORM_HPP

#ifndef USE_QOBJECT
class QObject
{
public:
    QObject(QObject *){}
    QObject(const QObject &){}
};
#endif

typedef struct _buffer_t buffer_t;
struct PhysicalInput;

#ifdef WIN32
#ifdef BUILD_CPCAP_DLL
#define EXPORT_DLL __declspec(dllexport)
#else
#define EXPORT_DLL __declspec(dllimport)
#endif
#else
#define EXPORT_DLL
#endif

#ifdef WIN32 /* Especifico de WINDOWS */
#include <Windows.h>
#include <DShow.h>
#include <mdshow.hpp>
#include <sample-grabber.hpp>

#define PLATFORM_DECLS \
    TCHAR                 *deviceID; \
    TCHAR                 *deviceName; \
    IBaseFilter           *pCap; \
    IBaseFilter           *pGrabber; \
    IBaseFilter           *nullRenderer; \
    IBaseFilter           *pCrossbar; \
    IGraphBuilder         *pGraph; \
    ICaptureGraphBuilder2 *pBuild; \
    IMediaControl         *pControl; \
    ISampleGrabber        *pSampleGrabber; \
    SampleGCB             *sgCallback; \
    GUID     capture_mode; \
    HRESULT  getDeviceFilter(); \
    HRESULT  insertFilter(const TCHAR *str, IBaseFilter **fltr, CLSID id); \
    HRESULT  checkCrossbar(); \
    long setupSize(); \
    void cleanUp();
#elif defined LINUX /* Especifico de LINUX */
#define PLATFORM_DECLS \
    char                *deviceID; \
    char                *deviceName; \
    bool                openDevice(); \
    bool                initializeBuffers(unsigned int size); \
    int                 startCapture(); \
    bool                enumInputs(PhysicalInput **, unsigned int *); \
    bool                enumFormats(); \
    int                 fd; \
    bool                inverted; \
    pthread_t           thread; \
    buffer_t            *buffers; \
    unsigned int        formats_count; \
    unsigned int        n_buffers; \
    int                 mode;
#endif


#endif // PLATFORM_HPP
